//
//  main.cpp
//  Practice5
//
//  Created by 赵世杰 on 2020/6/20.
//  Copyright © 2020 zhaoshijie. All rights reserved.
//

#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <cstring>

using namespace std;

const int ArSize = 16;

struct Car {
    
    char producer[20];
    
    int year;
    
};

int main(int argc, const char * argv[]) {
    // insert code here...
//    std::cout << "Hello, World!\n";
    
//    cout << "Hello,World!\n";
    
    
    /*
    
    int number0;
    int number1;
    
    cout << "请输入数字0: " << endl;
    
    cin >> number0 ;
    
    cout << "请输入数字1: " << endl;
    
    cin >> number1 ;
    
    int sum = 0;
    
    for (int i = number0+1; i<number1; i++) {
        
        sum += i;
        
    }
    
    
    cout << "总和：" << sum ;
     
     */
    
    
    /*
    array<long double, ArSize> factorials ;
    
    factorials[0] = factorials[1] = 1;
    
    for(int i = 2 ; i< ArSize ; i++)
    {
        factorials[i] = factorials[i-1] * i;
    }
    
    for(int i=0 ; i<factorials.size() ; i++)
    {
        cout << i << "! 为" << factorials[i] << endl;
    }
    */
    
    
    /*
    long double sum = 1;
    
    int number ;
    
    cout << "请输入数字：" << endl;
    
    cin >> number;
    
    while (number != 0) {
        
        sum *= number;

        cout << "请输入数字：" << endl;

        cin >> number;
        
        
    }
     
    
    cout << "总和：" << sum;
     */
    
    /*
    double profit0 = 0.1;
    double profit1 = 0.05 ;
    
    
    long double totalAmount0 = 100;
    long double totalAmount1 = 100;
    
    
    int year = 0;
    
    do {
        
        totalAmount0 += 100*profit0;
        totalAmount1 += totalAmount1*profit1;
        
        year++;
        
    } while (totalAmount0>totalAmount1);
    
    
    cout << to_string(year) + "年之后，B将超过A，此时A的总资金为：" + to_string(totalAmount0) + "B的总资金为：" + to_string(totalAmount1) << endl;
    */
    
    
    /*
    string month[12] = {
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "Augest",
        "September",
        "October",
        "November",
        "December"
        
    };
    
    long number[12];
    
    for (int i=0; i<sizeof(month)/sizeof(month[0]); i++) {
        
        cout << "月份：" << month[i] << "的销量：" << endl;
        
        cin >> number[i];
        
    }
    
    
    
    long total = 0;
    
    for(int i=0 ; i<sizeof(number)/sizeof(number[0]) ; i++)
    {
        total += number[i];
    }
    
    cout << "销售总量为：" << total << endl;
    
    */
    
    
    /*
    string month[12] = {
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "Augest",
        "September",
        "October",
        "November",
        "December"
        
    };
    
    string year[3] = {"2018","2019","2020"};
    
    
    long number[3][12];
    
    
    for (int i=0; i<sizeof(number)/sizeof(number[0]); i++)
    {
        cout << year[i] << "年份" << endl;

        for (int j=0; j<sizeof(number[0])/sizeof(number[0][0]); j++) {
            
            cout << "月份：" << month[i] << "的销量：" << endl;
            
            cin >> number[i][j];
            
        }
        
    }
    
    
    for (int i = 0 ; i<sizeof(number)/sizeof(number[0]); i++) {
        

        
        long total = 0;
        
        for(int j=0 ; j<sizeof(number[0])/sizeof(number[0][0]) ; j++)
        {
            total += number[i][j];
        }
        
        cout << year[i] << "年的销售总量为：" << total << endl;
        
    }
    */
    
    
//
//    string producer;
//
//    int year;
    
    
    /*
    int count = 0 ;
    
    cout << "How many cars do you wish tocatalong?" << endl;
    
    cin >> count;
    
    
    cin.get();  //吸收上一次输入的最后的回车
    cin.clear();  //清空标记
    
    
    std::vector<Car> carList;
    
    for (int i=0; i<count; i++) {
        
        
//        Car *car = new Car();
        
        Car car ;
        
        cout << "Car #" + to_string(i) + ":" << endl;
        
        cout << "Please enter the make: ";
        
        char producer[20] ;
        
        
        
        cin.getline(producer, 20);
        
        
        cin.clear();  //清空标记
        
        
        strcpy(car.producer, producer);
        
        
        
        cout << "Please enter the year made: ";
        
        int year ;
        
        cin >> year;
        
        car.year = year;
        
        
        cin.get();  //吸收上一次输入的最后的回车
        cin.clear();  //清空标记
        
        
        carList.push_back(car);
        
        
    }
    
    for (int i=0; i<carList.size(); i++) {
        
//        printf(carList[i]);
        
        Car car ;
        
        car = carList[i];
        
        cout << car.year << " " << car.producer << endl;

        
        
    }
     */
    
    /*
    char ch;
    
    int count = 0;
    
    cout << "Enter char ; enter # to quit:\n";
    
//    cin >> ch;
    cin.get(ch);
    
    while (ch != '#') {
        
        cout << ch ;
        
        ++ count;
        
        cin.get(ch);
//        cin >> ch;
        
    }
    
    cout << endl;
     */
    
    
    
    /*
    char word[20];
    
    char done[20] = {'D','o','n','e'} ;
    
//    char allWord[100];
    
    int count = 0;
    

    char ch ;
    
//    cin.get(ch);
    
    while (strcmp(word, done) != 0) {
        
        
        cin.get(ch);
        
        if(ch == ' ')
        {
            cout << word << endl;
            
            count = 0;
            
            
            //  清空char数组
            
            for (int i=0; i<sizeof(word)/sizeof(word[0]); i++) {
                
                word[i] = '\0';
            }
            
        }
        else if(ch == '\n')
        {
            cout << word << endl;
            
            break;
        }
        else
        {

            word[count] = ch;
            
            count++;
        }
        
        
        
    }
     */
    
    
    
    /*
    string word[20] ;
    
    string done = "Done";
        
    //    char allWord[100];
        
    int count = 0;
    
    string ch;
    
    cin >> ch;
        
    while (ch != "Done") {
        
        word[count] = ch;
        
        count ++;
        
        cin >> ch;
        
    }
    
    
    for (int i=0;i<count; i++) {
        
        cout << word[i] << endl;
        
    }
    */
    
    
    cout << "Enter number of rows：" << endl;
    
    int row ;
    
    cin >> row;
    
    
    for (int i=0; i<row; i++)
    {
        for (int j=0; j<row; j++)
        {
            if(i<row-j-1)
            {
                cout << ". " ;
            }
            else
            {
                cout << "* ";
            }
            
        }
        
        cout << endl;
    }
    

    
    
    return 0;
}
